package com.sms.gui.actions;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.JOptionPane;

import com.sms.util.ResourcesHandler;

public class ExitAction extends AbstractAction {

    private static final long serialVersionUID = 1L;

    public ExitAction() {
        super();
        putValue(AbstractAction.NAME, "Esci");
        putValue(AbstractAction.SMALL_ICON, ResourcesHandler.CANCEL_IMG);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (JOptionPane.showConfirmDialog(null,
                "Vuoi davvero chiudere l'applicazione?", "Conferma",
                JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION)
            System.exit(1);
    }
}
